const Router = require('@koa/router')
const rewire = require('rewire')
const {success, fail} = rewire('./common.cjs')
const oauth = rewire('../common/oauth.cjs')

const makeRoute = () => {
    const router = new Router()
    router.post('/oauthGithub', async (ctx, next) => {
        const rs = oauth.oauthGithub(ctx)
	ctx.body = rs
    })
    router.post('/oauthWechat', async (ctx, next) => {
        const rs = oauth.oauthWechat(ctx)
        ctx.body = rs
    })

    router.post('/oauthWeibo', async (ctx, next) => {
        const rs = oauth.oauthWeibo(ctx)
        ctx.body = rs
    })

    return router
}

module.exports = {makeRoute}
